class VocabularyController < ApplicationController
  def index
    @terms = scenario.next_terms 
    @scenario = scenario.terms
  end
  
  def add_term
    scenario.add_term params[:term]
    
    redirect_to :action => "index"
  end

  private
  def scenario
    get_or_create_session :scenario, Scenario.new
  end
  
  def get_or_create_session name, default
    value = session[name] || default
    session[name] = value
    value
  end
end
